import request from '@/api/request.js'

// 用户登录
export async function login(params) {
	return request('/login', params, 'post')
}

// 退出登录
export async function loginOut(params) {
	return request('/logout', params)
}

// 发送短信验证码
export async function sendSmsCode(params) {
	return request('/user/sendSmsCode', params)
}

// 获取用户信息
export async function getCurrentUser(params) {
	return request('/user/getCurrentUser', params)
}

// 微信登录
export async function weLogin(params) {
	return request('/auth/login', params)
}

// 用户注册
export async function register(params) {
	return request('/user/newRegister', params, 'post')
}

// 忘记密码
export async function resetPassword(params) {
	return request('/user/updatePassword', params, 'post')
}

// 核销验证码
export async function checkResetCode(params) {
	return request('/user/checkResetCode', params)
}

// 设置用户昵称
export async function updateNickName(params) {
	return request('/user/updateNickName', params, 'post')
}

// 绑定微信号
export async function bindWeChat(params) {
	return request('/user/bindUser', params, 'post')
}

// 修改手机号
export async function setMobile(params) {
	return request('/mine/setMobile', params, 'post')
}

// 设置支付密码
export async function setPayPwd(params) {
	return request('/user/setPayPwd', params, 'post')
}

// 收货地址列表
export async function addressList(params) {
	return request('/userAddress/list', params)
}

// 根据id设置默认地址
export async function setDefaultAddre(params) {
	return request('/userAddress/default', params, 'post')
}

// 根据id删除收货地址
export async function deleteUserAddress(params) {
	return request('/userAddress/delete', params, 'post')
}

// 新增收货地址
export async function addAddress(params) {
	return request('/userAddress/add', params, 'post')
}

// 根据id查看收货地址详情
export async function addressDetail(params) {
	return request('/userAddress/detail', params)
}

// 获取用户地区信息列表
export async function countryCurrency(params) {
	return request('/userAddress/getCountryList/sonList', params)
}

// 获取店铺货币
export async function getStoreCountryCurrMoneyName(params) {
	return request('/goods/getStoreCountryCurrMoneyName', params)
}

// 验证账号是否存在
export async function checkAccount(params) {
	return request('/user/checkAccount', params)
}

export const getStoreById = params => (
	request('/store/getById', params)
)

export const getMessageReadAction = params => (
	request('/news/isReadAll', params)
)

export const getMessageListAction = params => (
	request('/news/list', params, 'POST')
)

export const handleReadAllMessageAction = _ => (
	request('/news/readAll', _)
)

export const getMessageDetailAction = params => (
	request('/distributor/detailsById', params)
)

export const handleReadMessageAction = params => (
	request('/news/batchRead', params, 'POST')
)

// H5的语言配置列表
export const languageManagement = params => (
	request('/languageManagement/configuredList', params)
)

export const getCountryCurrencyList = params => (
	request('/user/getCountryCurrencyList', params)
)


// 获取归属地
export const sendCountryCurrencyList = params => (
	request('/user/getCountryCurrencyList', params)
)

export const getNewFlag = params => (
	request('/purchase/getNewFlag', params)
)


